#ifndef _LOG_HASH_TO_BIN_
#define _LOG_HASH_TO_BIN_

#include "typedef.h"


/* must be called before calling hash_to_bin() or bin_to_hash() */
int init_hex_map();



/* in:  ascii stream
 * out: binary stream
 * len: length of ascii stream. Not used anymore, must be zero!
 *
 * return: success
 */
int hash_to_bin(uchar **in, uchar **out, int len);



/* out:  ascii stream
 * in:   binary stream
 * len:  length of binary stream.
 * iscap:when iscap==1, convert to capital. iscap==0, to lowercase. otherwise, wrong!
 *
 * return: success
 */
int bin_to_hash(uchar **in, uchar **out, int len, int iscap);



/* input buf is an hash ascii stream. 
 * output is a binary stream, no space needed.
 */
uint do_hash_compress(uchar *out, uchar *buf, int len, int hash_len);



/* input is a hash binary stream, each hash_len bytes as a group(decompression unit)
 * out:	output, ascii stream. hashes sperated by space.
 * in:	input, binary stream. each hash_len bytes as one hash value.
 * len:	input stream length
 */
uint do_hash_decompress(uchar *out, uchar *in, int len, int hash_len, int iscap);


#endif
